import os
from shutil import copyfile

cls_name = {'AIRPLANE', 'BIRD', 'DRONE', 'HELICOPTER'}
video_path = r"E:\uav_datasets\Drone_detection_dataset-UAV4"
target_dir = r"E:\uav_datasets\Drone_detection_dataset-UAV2"

for cls in cls_name:
    mv_tg_dir = os.path.join(target_dir, "UAV")
    if cls == "BIRD":  # 鸟类目标单独分类,其他三类无人机目标统一分类到UAV目录下
        mv_tg_dir = os.path.join(target_dir, "OTHER")
    if not os.path.exists(mv_tg_dir): os.mkdir(mv_tg_dir)
    src_dir = os.path.join(video_path, cls)
    # 复制文件到mv_tg_dir
    for file_name in os.listdir(src_dir):
        copyfile(os.path.join(src_dir, file_name),
                 os.path.join(mv_tg_dir, file_name))
